<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">

<h:head>
	<title>祖龙娱乐  - BI系统</title>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="../../js/highcharts.js"></script>
	<script type="text/javascript" src="../../js/drawChart.js"></script>
</h:head>

<h:body>
	<ui:param name="bean" value="#{alivePlayerAction}" />
	
	<span class="pagetitle">玩家分析 —— 留存分析</span>
	<p:separator />
	
	<!-- 右侧页面顶部查询部分 -->
	<h:form id="fsearch">
		<p:growl id="growl" showDetail="true" sticky="true" />
        <p:calendar value="#{bean.dateStart}" mode="popup" pattern="yyyy-MM-dd" />
		-
		<p:calendar value="#{bean.dateEnd}" mode="popup" pattern="yyyy-MM-dd" />
		&#160;&#160;&#160;
		
		<p:selectOneMenu id="platformSel" styleClass="queryPlatform" value="#{bean.queryPlatform}">
	        <f:selectItems value="#{bean.platformItmes}" />
	        <p:ajax update="channelSel serverSel" listener="#{bean.updateChannelItmes}" />
        </p:selectOneMenu>
        &#160;&#160;&#160;
        
        <p:selectOneMenu id="channelSel" styleClass="queryChannel" value="#{bean.queryChannel}">
	        <f:selectItems value="#{bean.channelItmes}" />
	        <p:ajax update="serverSel platformSel" listener="#{bean.updateServerItmes}" />
        </p:selectOneMenu>
        &#160;&#160;&#160;
        
        <p:selectOneMenu id="serverSel" styleClass="queryServer" value="#{bean.queryServer}">
	         <f:selectItems value="#{bean.serverItmes}" />
	         <p:ajax update="channelSel platformSel" listener="#{bean.selectedServer}" />
        </p:selectOneMenu>
        &#160;&#160;&#160;
		
        <p:commandButton value="查询" action="#{bean.search()}" update=":data" ajax="false" />
	</h:form>
	<br />

	<!-- 数据展示部分，包含表格和图表 -->
	<h:form id="dform">
		<div class="data" id="data">
            <h:panelGrid columns="1" style="width:100%">
                <div id="basewidth" style="width:94%;height:0; border:0;">
                </div>
            </h:panelGrid>
            <p:panel id="panel" header="留存趋势" style="margin-bottom:10px;">
                <p:selectOneButton value="#{bean.selectedType}">
                    <f:selectItem itemLabel="新增设备" itemValue="1" />
                    <f:selectItem itemLabel="新增帐号" itemValue="2" />
                    <f:selectItem itemLabel="活跃帐号" itemValue="3" />
                    <f:selectItem itemLabel="首付帐号" itemValue="4" />
                    <p:ajax update="panel" listener="#{bean.selectType}" />
                </p:selectOneButton>
                <br />

                <p:dataGrid id="chart1" var="c" value="#{bean.chartData}" columns="1" layout="grid">
                    <p:panel style="text-align:center">
                        <h:panelGrid columns="1" style="width:100%">
                            <div id="highchartChart1" style="width:100%;height:300px; border:0;">
                                <script type="text/javascript">
                                    generateChart('#{c.jsonStr}', '#{c.jsonType}', '1', 'basewidth');
                                </script>
                            </div>
                        </h:panelGrid>
                    </p:panel>
                </p:dataGrid>

                <p:dataTable id="dlist1" var="l" value="#{bean.dataList}" resizableColumns="true" paginator="true" paginatorPosition="top" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}" rowsPerPageTemplate="15,30" rows="30" style="text-align:center;">
                    <f:facet name="{Exporters}">
                        <h:commandLink styleClass="exporter">
                            <p:graphicImage url="/resources/images/excel.png" height="25px"/>
                            <p:dataExporter type="xls" target="dlist1" fileName="alivePlayerData-#{pageHelper.getNewDateDetailStr()}" />
                        </h:commandLink>
                    </f:facet>

                    <p:column headerText="日期" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{l.dateStr}" />
                    </p:column>
                    <p:column headerText="用户数" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{l.newUser}" />
                    </p:column>
                    <p:column headerText="次留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the2Left)}" />
                    </p:column>
                    <p:column headerText="3留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the3Left)}" />
                    </p:column>
                    <p:column headerText="4留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the4Left)}" />
                    </p:column>
                    <p:column headerText="5留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the5Left)}" />
                    </p:column>
                    <p:column headerText="6留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the6Left)}" />
                    </p:column>
                    <p:column headerText="7留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the7Left)}" />
                    </p:column>
                    <p:column headerText="14留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the14Left)}" />
                    </p:column>
                    <p:column headerText="30留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the30Left)}" />
                    </p:column>
                </p:dataTable>
            </p:panel>
            <br/>

            <p:panel id="panel2" header="分职业留存" style="margin-bottom:10px;">
                <p:calendar value="#{bean.schoolDate}" mode="popup" pattern="yyyy-MM-dd" />
                &#160;&#160;&#160;

                <p:selectOneMenu id="platformSel2" styleClass="queryPlatform" value="#{bean.queryPlatform2}">
                    <f:selectItems value="#{bean.platformItmes2}" />
                    <p:ajax update="channelSel2 serverSel2" listener="#{bean.updateChannelItmes2}" />
                </p:selectOneMenu>
                &#160;&#160;&#160;

                <p:selectOneMenu id="channelSel2" styleClass="queryChannel" value="#{bean.queryChannel2}">
                    <f:selectItems value="#{bean.channelItmes2}" />
                    <p:ajax update="serverSel2 platformSel2" listener="#{bean.updateServerItmes2}" />
                </p:selectOneMenu>
                &#160;&#160;&#160;

                <p:selectOneMenu id="serverSel2" styleClass="queryServer" value="#{bean.queryServer2}">
                    <f:selectItems value="#{bean.serverItmes2}" />
                    <p:ajax update="channelSel2 platformSel2" listener="#{bean.selectedServer2}" />
                </p:selectOneMenu>
                &#160;&#160;&#160;

                <p:commandButton value="查询" action="#{bean.search2()}" update="panel2" ajax="true" />

                <br/><br/>

                <p:dataGrid id="chart2" var="c" value="#{bean.chartSchoolData}" columns="1" layout="grid" rendered="true">
                    <p:panel style="text-align:center">
                        <h:panelGrid columns="1" style="width:100%">
                            <div id="highchartChart2" style="width:100%;height:300px; border:0;">
                                <script type="text/javascript">
                                    generateChart('#{c.jsonStr}', '#{c.jsonType}', '2', 'basewidth');
                                </script>
                            </div>
                        </h:panelGrid>
                    </p:panel>
                </p:dataGrid>

                <p:dataTable id="dlist2" var="l" value="#{bean.dataSchoolList}" resizableColumns="true" paginator="true" paginatorPosition="top" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown} {Exporters}" rowsPerPageTemplate="15,30" rows="30" style="text-align:center;">
                    <f:facet name="{Exporters}">
                        <h:commandLink styleClass="exporter">
                            <p:graphicImage url="/resources/images/excel.png" height="25px"/>
                            <p:dataExporter type="xls" target="dlist2" fileName="alivePlayerBySchoolData-#{pageHelper.getNewDateDetailStr()}" />
                        </h:commandLink>
                    </f:facet>

                    <p:column headerText="职业" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{l.schoolName}" />
                    </p:column>
                    <p:column headerText="新增角色数" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{l.newRole}" />
                    </p:column>
                    <p:column headerText="次留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the2Left)}" />
                    </p:column>
                    <p:column headerText="3留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the3Left)}" />
                    </p:column>
                    <p:column headerText="4留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the4Left)}" />
                    </p:column>
                    <p:column headerText="5留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the5Left)}" />
                    </p:column>
                    <p:column headerText="6留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the6Left)}" />
                    </p:column>
                    <p:column headerText="7留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the7Left)}" />
                    </p:column>
                    <p:column headerText="14留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the14Left)}" />
                    </p:column>
                    <p:column headerText="30留" styleClass="column" style="width:80px">
                        <h:outputLabel value="#{pageHelper.double2Percent(l.the30Left)}" />
                    </p:column>
                </p:dataTable>
            </p:panel>
		</div>
	</h:form>

	<!-- 页脚 -->
	<div class="footer"></div>
</h:body>
</html>